package cn.hackcloud.demo.dubbo;

import cn.hackcloud.demo.dubbo.rpc.IUserService;
import com.alibaba.fastjson.JSON;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.config.RegistryConfig;

public class BasConsumer {

    public static <T> ReferenceConfig<T> referenceConfig() {
        ReferenceConfig<T> reference = new ReferenceConfig<>();
        reference.setApplication(new ApplicationConfig("consumer"));
        reference.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
        reference.setInterface("cn.hackcloud.demo.dubbo.rpc.IUserService");
        reference.setGroup("hackcloud");
        reference.setVersion("1.0");
        return reference;
    }

    static void print(Object o) {
        System.out.println(JSON.toJSONString(o));
    }
}
